package br.com.fpf.pontoapp.model.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import br.com.fpf.pontoapp.model.db.impl.Table;

/**
 * 
 * BaseEntity abstract class
 * 
 */
public abstract class AbstractBaseEntity implements Serializable {

	private static final int INIT_PRIME = 31;

	private static final long serialVersionUID = 1L;

	public static final String ID_COLUMN = "ID";

	private Long idEntity;

	public Map<Table, String> getChildTable() {
		return new HashMap<Table, String>();
	}

	@Override
	public int hashCode() {
		int prime;
		prime = INIT_PRIME;
		int result;
		result = prime * 1 + ((idEntity == null) ? 0 : idEntity.hashCode());
		return result;
	}

	@Override
	public boolean equals(final Object obj) {
		boolean result = true;

		if (obj == null) {
			result = false;
		} else if (getClass() == obj.getClass()) {
			final AbstractBaseEntity other = (AbstractBaseEntity) obj;
			if (idEntity == null) {
				if (other.idEntity != null) {
					result = false;
				}
			} else if (!idEntity.equals(other.idEntity)) {
				result = false;
			}
		} else {
			result = false;
		}
		return result;
	}

	public Long getId() {
		return idEntity;
	}

	public void setId(final Long idEntity) {
		this.idEntity = idEntity;
	}

}
